﻿using System;
using Dsl.Ped.Framework.Common;

namespace Dsl.Ped.Framework.Exceptions
{
    /// <summary>
    /// Exception thrown when the projection is already registered in the container
    /// </summary>
    public class ProjectionAlreadyRegisteredException : Exception
    {
        /// <summary>
        /// Gets or sets the container in which the registration failed
        /// </summary>
        public IProjectionContainer ProjectionContainer { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectionAlreadyRegisteredException"/> class.
        /// </summary>
        /// <param name="projectionContainer">The projection container in which the registration failed</param>
        /// <param name="projectionName">The name of the projection which failed during the registration</param>
        public ProjectionAlreadyRegisteredException(IProjectionContainer projectionContainer, string projectionName)
            : base(string.Format("Projection of name {0} has been already registered in the container {1}", projectionName, projectionContainer.Name))
        {
            ProjectionContainer = projectionContainer;
        }
    }
}
